home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Floppyshop 2
/
Floppyshop - 2.zip
/
Floppyshop - 2.iso
/
diskmags
/
0022-3.564
/
dmg-3557
/
news.txt
/
stos4.asc
< prev
next >
Wrap
Text File
|
1989-04-05
|
7KB
|
168 lines
STOS BASIC TUTORIAL - PART FOUR
-------------------------------
Written by Lozian for STEN
--------------------------
Last time we concentrated on getting a picture to appear on the screen
from the memory bank,and hopefully you have mastered this. This
articlewill move on (excuse the pun), to show you how to scroll the
screen you have designated to appear, hopefully in the direction that you
require.
So let us begin by booting up your COPY (Your COPY only), of STOS.
Direct Commands - RESERVE AS DATASCREEN 5:LOAD "\STOS\PIC.PI1",5
What we have done is reserve memory for the screen so that we are not
continually accessing the drive and have loaded the screen into BANK 5
ready for recall when required. Screen PIC.PI1 is in the STOS folder,
hence the syntax,but you can load in any screen of your choice into a BANK
of your choice provided you follow the rules as above. The only
stipulation as regards BANK of your choice,is to be careful if you are
using accessories and pick the QUIT & GRAB option,since the accessory may
try,and succeed,to grab the BANK space you have reserved.
You are normally warned about this from the accessory. The manual does
explain which BANK's are used by SPRITES etc.
Now study the following listing and I will endeavour to explain what is
happening with the help of REM statements.
10 MODE 0:FLASH OFF:HIDE:CURS OFF:KEY OFF:BACK=LOGIC
20 GET PALETTE (5):REM Get correct screen colours.
30 APPEAR 5,30:REM Recall screen from BANK 5,fade in no.30 (or choose).
40 DEF SCROLL 1,0,0 TO 320,200,1,-1:REM 1st parameter is scroll no.and
you can define up to sixteen scroll zones,2nd and 3rd parameters are
top left of scroll area TO 4th and 5th being bottom right of scroll
area (full screen in this example).6th parameter defines direction
of scroll in pixels, negative being left and positive being right.
7th parameter defines direction up (negative) or down (positive) by
no.of pixels at each scroll call.
50 SCROLL 1:REM Call scroll previously defined.
60 SCREEN COPY 5 TO LOGIC:REM Copy back original screen.
70 GOTO 50:REM Enter loop to show effect.
Remember to RUN it.
This routine gives a jittering screen providing your display is not
already like this.
To break out of this program use Control+C but specially note that if the
screen is being updated it may be a moment or two before your keypress is
read. So be patient.
Now try this.
10 MODE 0:FLASH OFF:HIDE:CURS OFF:KEY OFF:BACK=LOGIC
20 GET PALETTE (5)
30 APPEAR 5,22
40 DEF SCROLL 1,0,0 TO 320,200,0,1:REM Try last parameter 5.
50 FOR Y=0 TO 100:REM Try inserting STEP 5.
60 SCREEN COPY BACK,0,0,320,200 TO LOGIC,0,1:REM Try last parameter 5.
70 SCROLL 1
80 NEXT Y
90 CLS
100 APPEAR 5,15
110 GOTO 35
This is a down scroll. Try changing the parameters in the lines that are
specified,but change them all equally first and view the effect, then try
different values in different lines to clarify what is actually going on.
Please remember that you are specifying amount of pixels to move and large
numbers are inclined to be jerky.
A further routine.
10 MODE 0:FLASH OFF:HIDE:CURS OFF:KEY OFF:BACK=LOGIC
20 GET PALETTE (5)
30 APPEAR 5,12
40 DEF SCROLL 1,0,0 TO 320,200,1,1
50 FOR Y=0 TO 100
60 SCREEN COPY BACK 0,0,320,200 TO LOGIC 1,1
70 SCROLL 1
80 NEXT Y
90 CLS
100 APPEAR 5,50
110 GOTO 40
This is a down right scroll.(mmm). Try an up left scroll.
After you have defined a scroll area and direction etc. it can be called
at any time. If a CLEAR command intervenes in the program,the scroll area
will have to be defined again,but of course a CLEAR command also creates
other problems,and is to be avoided.
I will briefly mention another set of SCROLL commands. Do not confuse
these commands with the previously explained scrolling operations.
SCROLL ON - A new line is automatically inserted when the CURSOR reaches
past the bottom of the screen.(Default Mode)
SCROLL OFF - When the CURSOR reaches past the bottom of the screen it
will reappear at the top.
SCROLL UP - Moves the section of the current window above the CURSOR
one line up.
SCROLL DOWN - Will scroll the area below the CURSOR one line down,and
the bottom line will be overwritten.
Whether these commands are of any use in your program's I leave you to
find out. One point to note is that if a screen is displayed and it
occupies the bottom line,a call to SCROLL ON in a loop will keep the full
screen displayed for the duration of the loop.
If you are experiencing problems with synchronisation of your screens, try
the command WAIT VBL in your program. This waits for a vertical blank
before updating the screen and may cure problems with screens or sprites.
The ORBIT game on the games disk makes heavy use of sprites and it is
worth studying the listing. LOAD up "ORBIT.BAS" and list the program for a
look, controlling the listing with the SPACEBAR. If you have a printer
attached, use LLIST to get a hardcopy. STOS makes it easy to search for
particular commands to examine. Use from DIRECT MODE the command SEARCH
"sprite" and STOS will find the first occurrence of the parameter
specified and present you with the line containing it on the screen. If
you wish to continue to the next occurrence of the same item, use SEARCH
by itself with no parameters. If no further occurrence exists you will get
the report SEARCH FAILED. Note especially that the SEARCH function will
look for the parameters quoted,and will differentiate between uppercase
and lowercase. To clarify, keywords entered from the EDITOR in uppercase
are converted to lowercase by STOS on entry to the program line. Got it!
So SEARCH "DSPRITE" will find DSPRITE but will not find dsprite. DSPRITE
of course can only be a variable. This confused me for a start. Certain
basic keywords cannot be used as variables OR part of a variable, notably
TO,STEP,THEN,ELSE,XOR,OR,AND,GOTO,GOSUB,MOD and AS as opposed to the other
keywords which can be used. Are you still there? So STEPS is not allowed
as a variable, but DPOKE is. POKER is not allowed so it would appear that
you can only use the PERMITTED keywords as variables after a preceding
letter. Phew!!
Next time - Creating your own customised drop down or be dropped MENU bar.
How to install and get running. Incorporating icons in the MENU bar, and
for some added spice,design your own fully functional mouse pointer. This
will introduce you to designing sprites with the very user friendly SPRITE
designer. Have fun and remember I only had 512k to play with and a half-
meg drive so don't be put off by memory or drive limitations. Have fun and
read about the variables again....
(c) Lozian MCMXC11.